package com.integrationpath.mengine.model;

// Generated Apr 2, 2009 11:32:43 AM by Hibernate Tools 3.2.2.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * Article generated by hbm2java
 * 
 * @author <a href="mailto:colaru@gmail.com">Cristian Olaru</a>
 */
@Entity
@Table(name = "article")
public class Article implements java.io.Serializable {

	private Long id;
	private AppUser appUser;
	private Type type;
	private Category category;
	private String nickname;
	private String emaiAddress;
	private String title;
	private String overview;
	private String content;
	private Date date;
	private String source;
	private String sourceLink;
	private Byte status;
	private Byte featured;
	private String titleComma;
	private String titleLine;
	private byte[] thumbnail;
	private Integer commentsNumber;
	private Integer mediasNumber;
	private Double ratingsNumber;
	private Long viewsNumber;
	private Set<Tag> tags = new HashSet<Tag>(0);
	private Set<Rating> ratings = new HashSet<Rating>(0);
	private Set<Comment> comments = new HashSet<Comment>(0);
	private Set<Media> medias = new HashSet<Media>(0);

	public Article() {
	}

	public Article(AppUser appUser, Type type, Category category,
			String nickname, String emaiAddress, String title, String overview,
			String content, Date date, Byte status, Byte featured,
			byte[] thumbnail, Integer commentsNumber, Integer mediasNumber,
			Double ratingsNumber, Set<Tag> tags, Set<Rating> ratings,
			Set<Comment> comments, Set<Media> medias) {
		this.appUser = appUser;
		this.type = type;
		this.category = category;
		this.nickname = nickname;
		this.emaiAddress = emaiAddress;
		this.title = title;
		this.overview = overview;
		this.content = content;
		this.date = date;
		this.status = status;
		this.featured = featured;
		this.thumbnail = thumbnail;
		this.commentsNumber = commentsNumber;
		this.mediasNumber = mediasNumber;
		this.ratingsNumber = ratingsNumber;
		this.tags = tags;
		this.ratings = ratings;
		this.comments = comments;
		this.medias = medias;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public AppUser getAppUser() {
		return this.appUser;
	}

	public void setAppUser(AppUser appUser) {
		this.appUser = appUser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type_id")
	public Type getType() {
		return this.type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "category_id")
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@Column(name = "nickname", length = 50)
	public String getNickname() {
		return this.nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	@Column(name = "emai_address", length = 50)
	public String getEmaiAddress() {
		return this.emaiAddress;
	}

	public void setEmaiAddress(String emaiAddress) {
		this.emaiAddress = emaiAddress;
	}

	@Column(name = "title", length = 200)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "overview", length = 65535)
	public String getOverview() {
		return this.overview;
	}

	public void setOverview(String overview) {
		this.overview = overview;
	}

	@Column(name = "content", length = 65535)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "date", length = 0)
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Column(name = "status")
	public Byte getStatus() {
		return this.status;
	}

	public void setStatus(Byte status) {
		this.status = status;
	}

	@Column(name = "featured")
	public Byte getFeatured() {
		return this.featured;
	}

	public void setFeatured(Byte featured) {
		this.featured = featured;
	}

	@Column(name = "thumbnail")
	public byte[] getThumbnail() {
		return this.thumbnail;
	}

	public void setThumbnail(byte[] thumbnail) {
		this.thumbnail = thumbnail;
	}

	@Column(name = "comments_number")
	public Integer getCommentsNumber() {
		return this.commentsNumber;
	}

	public void setCommentsNumber(Integer commentsNumber) {
		this.commentsNumber = commentsNumber;
	}

	@Column(name = "medias_number")
	public Integer getMediasNumber() {
		return this.mediasNumber;
	}

	public void setMediasNumber(Integer mediasNumber) {
		this.mediasNumber = mediasNumber;
	}

	@Column(name = "ratings_number", precision = 11)
	public Double getRatingsNumber() {
		return this.ratingsNumber;
	}

	public void setRatingsNumber(Double ratingsNumber) {
		this.ratingsNumber = ratingsNumber;
	}

	@Column(name = "views_number", precision = 11)	
	public Long getViewsNumber() {
		return viewsNumber;
	}

	public void setViewsNumber(Long viewsNumber) {
		this.viewsNumber = viewsNumber;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "article")
	public Set<Tag> getTags() {
		return this.tags;
	}

	public void setTags(Set<Tag> tags) {
		this.tags = tags;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "article")
	public Set<Rating> getRatings() {
		return this.ratings;
	}

	public void setRatings(Set<Rating> ratings) {
		this.ratings = ratings;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "article")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "article")
	public Set<Media> getMedias() {
		return this.medias;
	}

	public void setMedias(Set<Media> medias) {
		this.medias = medias;
	}
	
	@Transient
	public String getTitleComma() {
		return titleComma;
	}

	public void setTitleComma(String titleComma) {
		this.titleComma = titleComma;
	}

	@Transient
	public String getTitleLine() {
		return titleLine;
	}

	public void setTitleLine(String titleUnderline) {
		this.titleLine = titleUnderline;
	}

	@Column(name = "source")
	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}
	
	@Column(name = "sourceLink")
	public String getSourceLink() {
		return sourceLink;
	}

	public void setSourceLink(String sourceLink) {
		this.sourceLink = sourceLink;
	}

	
}
